_require local "../../../basis/main/SMLSharp_OSProcess.smi"
_require "../../../basis/main/Word8Vector.smi"
_require local "../../../basis/main/Word8VectorSlice.smi"
_require local "../../../basis/main/Word8Array.smi"
_require local "../../../basis/main/Word8ArraySlice.smi"
_require local "../../../basis/main/Int32.smi"
_require "../../../basis/main/IO.smi"
_require "./prim-io-bin.smi"
_require local "../Unix/posix-bin-prim-io.smi"

structure BinIO =
struct
  structure StreamIO =
  struct
    type elem = word8
    type vector = Word8Vector.vector
    type instream (= boxed)
    type outstream (= boxed)
    type out_pos (= boxed)
    type reader = BinPrimIO.reader
    type writer = BinPrimIO.writer
    type pos = BinPrimIO.pos
    val input : instream -> vector * instream
    val input1 : instream -> (elem * instream) option
    val inputN : instream * int -> vector * instream
    val inputAll : instream -> vector * instream
    val canInput : instream * int -> int option
    val closeIn : instream -> unit
    val endOfStream : instream -> bool
    val output : outstream * vector -> unit
    val output1 : outstream * elem -> unit
    val flushOut : outstream -> unit
    val closeOut : outstream -> unit
    val mkInstream : reader * vector -> instream
    val getReader : instream -> reader * vector
    val filePosIn : instream -> pos
    val setBufferMode : outstream * IO.buffer_mode -> unit
    val getBufferMode : outstream -> IO.buffer_mode
    val mkOutstream : writer * IO.buffer_mode -> outstream
    val getWriter : outstream -> writer * IO.buffer_mode
    val getPosOut : outstream -> out_pos
    val setPosOut : out_pos -> outstream
    val filePosOut : out_pos -> pos
  end
  type vector = StreamIO.vector
  type elem = StreamIO.elem
  type instream (= ref)
  type outstream (= ref)
  val input : instream -> vector
  val input1 : instream -> elem option
  val inputN : instream * int -> vector
  val inputAll : instream -> vector
  val canInput : instream * int -> int option
  val lookahead : instream -> elem option
  val closeIn : instream -> unit
  val endOfStream : instream -> bool
  val output : outstream * vector -> unit
  val output1 : outstream * elem -> unit
  val flushOut : outstream -> unit
  val closeOut : outstream -> unit
  val mkInstream : StreamIO.instream -> instream
  val getInstream : instream -> StreamIO.instream
  val setInstream : instream * StreamIO.instream -> unit
  val mkOutstream : StreamIO.outstream -> outstream
  val getOutstream : outstream -> StreamIO.outstream
  val setOutstream : outstream * StreamIO.outstream -> unit
  val getPosOut : outstream -> StreamIO.out_pos
  val setPosOut : outstream * StreamIO.out_pos -> unit
  val openIn : string -> instream
  val openOut : string -> outstream
  val openAppend : string -> outstream
end
